﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using PluginAPI;    //主程序插件接口
using PluginManage; //插件管理器

namespace Main
{
    /// <summary>
    /// 主程序
    /// </summary>
    public partial class frmMain : Form, IApplication
    {
        private PluginManage.PluginManage plugManage;

        public frmMain()
        {
            InitializeComponent();

            plugManage = new PluginManage.PluginManage(this);
            plugManage.LoadAllPlugin();
        }

        public string GetVersion()
        {
            return "1.0.1";
        }

        //加载
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (string filename in plugManage.plugs.Keys)
            {
                IPlugin plug = plugManage.plugs[filename];
                plug.Load();
            }
        }
        //访问
        private void button2_Click(object sender, EventArgs e)
        {
            foreach (string filename in plugManage.plugs.Keys)
            {
                IPlugin plug = plugManage.plugs[filename];
                MessageBox.Show(plug.Author, "作者");
            }
        }
        //卸载
        private void button3_Click(object sender, EventArgs e)
        {
            foreach (string filename in plugManage.plugs.Keys)
            {
                IPlugin plug = plugManage.plugs[filename];
                plug.UnLoad();
            }
        }
    }
}
